<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ include file="../session.jsp"%>
<!DOCTYPE html>
<html lang="ko">
<head>
<%@ include file="../head.jsp"%>${alert}
<style>
	.page-header {
		margin-top: -30px;
	}
	.box {
		width: 50%; height: 50%;
	}
	.input-group-addon {
		background-color: #ffffff;
		border: 0px;
	}
	.img-thumbnail {
		width: 100px;
	}
</style>
</head>
<body>
	<div class="container">
		<div class="page-header clearfix">
			<h2 class="pull-left">이벤트 덧글리스트</h2>
			<div class="pull-right" style="padding-top: 30px">
				<a href="#" id="opensearch" class="btn btn-info">검색조건 펼치기/접기</a>
			</div>
		</div>
		
		<div id="searchdiv">
			<form id="searchUserPouch" class="form-horizontal" role="form" method="get" action="eventComment.do">
			
				<input type="hidden" name="id" value="${id}"/>
			
				<fieldset>
					<div class="clearfix">
					
						<div class="box pull-left">
							<div class="form-group">
								<label for="nickName" class="col-md-2 control-label">닉네임</label>
								<div class="col-md-9">
									<input type="text" class="form-control" name="nickName">
								</div>
							</div>
							
							<div class="form-group">
								<label for="commentText" class="col-md-2 control-label">내용</label>
								<div class="col-md-9">
									<input type="text" class="form-control" name="commentText">
								</div>
							</div>
						</div>
						
						<div class="box pull-right">
							<div class="form-group">
								<label for="start_date" class="col-md-2 control-label">작성일시</label>
								<div class="col-md-9 input-group input-group-sm">
									<input type="date" class="form-control" name="start_date">
									<span class="input-group-addon">~</span>
									<input type="date" class="form-control" name="end_date">
								</div>
							</div>
							
							<div class="form-group">
								<div class="col-md-11">
									<div class="row">
										<div class="col-md-6">
											<button type="submit" class="btn btn-primary btn-block">검색하기</button>
										</div>
										<div class="col-md-6">
											<button type="reset" class="btn btn-warning btn-block">다시작성</button>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
						
				</fieldset>
			</form>
			<hr/>
		</div>
		
		<span class="pull-left" style="margin-bottom:10px;">등록 : ${page.totalArticleCount}건 / 활성 : ${display}건 / 비활성 : ${unDisplay}건</span>
		<br/>
		<c:forEach items="${comment}" var="list">
			<div class="media">
				<div class="pull-left">
					<c:choose>
						<c:when test="${list.image == null}">
							<img class="media-object img-thumbnail" src="assets/img/noimage.png"/>
						</c:when>
						<c:otherwise>
							<img class="media-object img-thumbnail" src="download.jsp?${list.image}&size=320"/>
						</c:otherwise>
					</c:choose>
				</div>
				<div class="media-body">
					<h4 class="media-heading">${list.idRegisterValue}&nbsp;
						<small>${fn:substring(list.create_date, 0, 4)}-${fn:substring(list.create_date, 4, 6)}-${fn:substring(list.create_date, 6, 8)}
						&nbsp;${fn:substring(list.create_date, 8, 10)}:${fn:substring(list.create_date, 10, 12)}</small>&nbsp;
						<c:choose>
							<c:when test="${list.isDisplay == 1}">
								<a href="eventComment.do?page=${page.nowPage}&rId=${list.idRegister}&id=${list.idAdminBoard}&isDisplay=${list.isDisplay}${where}">
									<button type="button" class="btn btn-xs unDisplay">노출삭제</button>
								</a>
							</c:when>
							<c:otherwise>
								<a href="eventComment.do?page=${page.nowPage}&rId=${list.idRegister}&id=${list.idAdminBoard}&isDisplay=${list.isDisplay}${where}">
									<button type="button" class="btn btn-xs btn-primary display">노출승인</button>
								</a>
							</c:otherwise>
						</c:choose>
					</h4>
					${list.eventComment}
				</div>
			</div>
			<hr/>
		</c:forEach>
		
	</div>

	<script src="assets/js/jquery.js"></script>
	<script src="assets/js/bootstrap.min.js"></script>
	<script>
		$(function() {
			$("#searchdiv").hide();
			
			$("#opensearch").click(function() {
				$("#searchdiv").toggle();
				return false;
			});
			
			$(".unDisplay").click(function() {
				if (!confirm("정말 비활성처리 하시겠습니까?")) {
					return false;
				}
			});
			
			$(".display").click(function() {
				if (!confirm("정말 승인처리 하시겠습니까?")) {
					return false;
				}
			});
		});
	</script>
</body>
</html>